import { RANGE_SEARCH, searchTypeConfig } from '../config';
import type { Widget } from '../type';

export const getWidgetDefaultValue = (widget: Widget) => {
  let defaultValue: any = '';
  for (let searchType in searchTypeConfig) {
    if (Object.hasOwnProperty(searchType)) {
      // @ts-ignore
      const config = searchTypeConfig[searchType];
      if (config.widgets.includes(widget)) {
        if (Number(searchType) === RANGE_SEARCH) defaultValue = [];
      }
    }
  }
  return defaultValue;
};
